import java.util.*;
public class AverageMinus3Max {
	static int findAverageMinus3Max()
	{
		int sum = 0;
		int count =0;
		int max1=0,max2=0,max3=0;
		Scanner in = new Scanner(System.in);
		int input = in.nextInt();
		while(input != 0)
		{
			sum+=input;
			count+=1;
			if(max1<input)
			{
				int temp1 = max1;
				max1 = input;

				if(max2<temp1)
				{
					int temp2 = max2;
					max2 = temp1;

					if(max3<temp2)
					{
						int temp3 = max3;
						max3 = temp2;
					}
				}

			}

			input = in.nextInt();
		}

		sum-=max1+max2+max3;
		count-=3;
		System.out.println("max1 = "+max1+"max2 = "+max2+"max3 = "+max3+"average without 3 = "+sum/count);
		return(sum/count);


	}
	public static void main(String[] args) {
		findAverageMinus3Max();
	}
	
}